/**
 * Created by eva on 2019/12/29.
 * 判断大鱼和果实的距离
 */
function momFruitCollision() {
    for(var i = 0; i < fruit.num; i++){
        if(fruit.alive[i]){
            //calculate length
            var l = calLength2(fruit.x[i],fruit.y[i],mom.x,mom.y);
            if(l < 900){
                //fruit eaten
                fruit.dead(i);
                data.fruitNum++;
                if(fruit.fruitType[i] == "blue"){
                    data.double = 2;
                    mom.bigBlueIndex++;
                }else{
                    data.double = 1;
                    mom.bigOrangeIndex++;
                }
                wave.born(fruit.x[i],fruit.y[i]);
            }

        }
    }
}
function momBabyCollision() {
    if(!data.fruitNum){
        return;
    }
    var l = calLength2(mom.x,mom.y,baby.x,baby.y);
    if(l < 900){
        baby.babyFadeIndex = 0;
        data.addScore();
        mom.bigBlueIndex = 0;
        mom.bigOrangeIndex = 0;
        halo.born(baby.x,baby.y);
    }

}

